﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebComponents;
using WebComponents.Data;
using WebComponents.Security;
using System.Web.SessionState;

public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (ConvertType.ToString(Request.Params["action"]) != "")
        {
            Session["login"] = null;
            Response.Redirect("../Default.aspx");
        }
    }
    protected void btnDangNhap_Click(object sender, EventArgs e)
    {
        UserInfo user = UserController.GetByUserName(txtUser.Text, Security.EncodingPass(txtPass.Text, "gbit"));
        if (user != null)
        {
            Session["login"] = user;
            Response.Redirect("Default.aspx");
        }
        else
        {
            lblThongBao.Text = "Sai tên đăng nhập hoặc mật khẩu";
            lblThongBao.Visible = true;
        }
    }
}
